package com.fuh.study.集合;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.ListIterator;
import java.util.Map;

/**
 * @创建人 fuh
 * @创建时间 2021/3/25  17:01
 * @描述
 */
public class Test {
    public static void main(String[] args) {
        ListIterator<Object> objectListIterator = new ArrayList<>().listIterator();


//        String a = new String("123");
//        String b = new String("234");
//        String c = new String("122");
//        String d = new String("123");
//        System.out.println(a.hashCode());
//        System.out.println(b.hashCode());
//        System.out.println(c.hashCode());
//        System.out.println(d.hashCode());
//
//        /**
//         * HashMap 的实现原理
//         * HashMap key基于hash实现
//         */
//        Map<String, Object> objectMap = new HashMap<>();
//        objectMap.put(a, null);
//        objectMap.put(b, null);
//        objectMap.put(c, null);
//        objectMap.put(d, new Object());
//        objectMap.forEach((key, value) -> {
//            System.out.println(key);
//        });


        System.out.println("=================================================");
        Entity entity1 = new Entity();
        Entity entity2 = new Entity();
        Entity entity3 = new Entity();
        Entity entity4 = new Entity();
        Entity entity5 = new Entity();

        Map<Entity, Object> entityMap = new HashMap<>();
        entityMap.put(entity5,"5");
        entityMap.put(entity3,"3");
        entityMap.put(entity1,"1");
        entityMap.put(entity2,"2");
        entityMap.put(entity4,"4");

        entityMap.forEach((key, value) -> {
            System.out.println(key+"="+value);
        });

        System.out.println(8 ^ (8 >>> 16));
        System.out.println(8 ^ (8 >>> 16));
    }

    static class Entity{
        @Override
        public int hashCode() {
            return 8;
        }
    }
}
